package org.mch.func.m_px.sorteg;

import java.awt.event.ActionEvent;

import javax.swing.JButton;

import org.mch.biz.ui.FuncEvent;
import org.mch.biz.ui.FuncPanel;
import org.mch.func.m_px.sorteg.handle.HandleCreateNewBtnArry;
import org.mch.func.m_px.sorteg.handle.HandleExchangeBtn;
import org.mch.func.m_px.sorteg.utils.MoveComponentGoBtnSort;

/**
 * 描述：；<BR/>
 * 
 * @author MCH；Date：2008-06-18；<BR/>
 *
 */
public class SortEvent extends FuncEvent {
	private static final long serialVersionUID = -589365474532268721L;

	public SortEvent(FuncPanel panel) {
		super(panel);
	}

	@Override
	protected void onButtonClick(ActionEvent e) throws Exception {
		if (e.getSource() == getPanel().getBtnCreateBtnArry()) {
			onCreateNewBtnArry(e);
		} else if (e.getSource() == getPanel().getBtnExchange()) {
			onBtnExchange(e);
		}
	}

	protected void onBtnExchange( ActionEvent e) throws Exception {
		MoveComponentGoBtnSort.MOVEBTNTIME = getPanel().getSliderMoveSpeed().getValue();
		new HandleExchangeBtn(getPanel()).onHandle((JButton) e.getSource());
	}

	protected void onCreateNewBtnArry(ActionEvent e ) {
		new HandleCreateNewBtnArry(getPanel()).onHandle((JButton) e.getSource());
	}

	@Override
	public SortPanel getPanel() {
		return (SortPanel) super.getPanel();
	}
}
